SWEP.Base = "weapon_ic_util_stickbase"

if SERVER then
	AddCSLuaFile ("shared.lua")
end

SWEP.Spawnable				= true

SWEP.PrintName			= "REPAIRSTICK"
SWEP.Description		= "A modified healstick designed to repair props instead of bodies."
SWEP.BeamColour = Color(0, 128, 255)

// Stuff that needs to be here...
SWEP.Cost				= 0
SWEP.Slot				= 3
SWEP.IconFont				= "HL2MPTypeDeath"
SWEP.IconLetter				= "!"


SWEP.Primary.Sound			= Sound ("Airboat_fan_idle")

SWEP.HealDelay = 0.2
SWEP.HealAmount = 10

SWEP.RechargeDelay = 2
SWEP.RechargeAmount = 10
SWEP.RechargeUpto = 150
SWEP.Primary.DefaultClip	= 151
SWEP.Primary.ClipSize	= -1

if CLIENT then killicon.AddFont("weapon_ic_repairstick", SWEP.IconFont, SWEP.IconLetter, Color(255, 80, 0, 255)) end

function SWEP:DoFire()
	local trace = util.QuickTrace( self.Owner:GetShootPos(), self.Owner:GetAimVector() * 192, self.Owner )
	if ( IsValid( trace.Entity ) and trace.Entity:GetClass() == "prop_physics" ) then
		local ent = trace.Entity
		local health = ent:GetPropHealth()
		local heal = math.min( math.min( ent:GetPropMaxHealth() - health, self.HealAmount ), self:Ammo() )
		if ( heal > 0 ) then
			ent:SetPropHealth( health + heal )
			self:TakePrimaryAmmo( heal )
			GAMEMODE:CallHook( "PlayerRepair", self.Owner, ent, heal )
		end
	end
end
